<?php
#
# author: Phil Spagnolo
# (c)2008 South Hill Calvary Chapel
#

include_once("./root.inc.php");
include("${root}/mysql/database_info.php");
include("${root}/common.php");
include("${root}/mysql/common.php");

function people($result, $num_rows) {
	
	for ($i=0; $i < $num_rows; $i++) {
		printf("<div class='content'>\n");
		printf("<TABLE class='std'>\n");
		$position=mysql_result($result,$i,"position");
		$first=mysql_result($result,$i,"first");
		$last=mysql_result($result,$i,"last");
		$phone=mysql_result($result,$i,"phone");
		$email=mysql_result($result,$i,"email");
		$picture=mysql_result($result,$i,"picture");
		$par1=mysql_result($result,$i,"par1");
		$name = $first." ".$last;
		printf("\t<tr>\n");
		printf("\t\t<td width='30px'>\n");
		
			if (!empty($par1)) {
				$id=mysql_result($result,$i,"id");
				printf("\t\t<td width='288px'>\n");
				printf("<a href='bio.php?id=%d'><img src='%s'></a>\n", $id, $picture);
				printf("</td>\n", $picture);
			} else {
				printf("\t\t<td width='288px'><img src='%s'></td>\n", $picture);
			}
		printf("\t\t<td width='30px'>&nbsp</td>\n");
		printf("\t\t<td align='left'>\n");
		printf("\t\t\t<TABLE class='std'>\n");
		printf("\t\t\t\t<tr><td><strong>%s</strong></td></tr>\n",$name);
		printf("\t\t\t\t<tr><td>%s</td></tr>\n",$position);
		printf("\t\t\t\t<tr><td><a href='mailto:%s'>%s</a></td></tr>\n",
		        $email, $email);
		printf("\t\t\t\t<tr><td>%s</td></tr>\n",$phone);
		if (!empty($par1)) {
			printf("\t\t\t\t<tr><td><br/><a href='bio.php?id=%d'>Read More</a></td></tr>\n",
							$id);
		}
		printf("\t\t\t</table>\n");
		printf("\t\t</td>\n");
		printf("\t<tr><td colspan='3'>&nbsp</td></tr>\n");
		printf("</table>\n");
		printf("</div>\n");
	}
	

}

$table = "people";
connect_select_test($table);

$linkList = array("history.php","beliefs.php","staff.php");
$textList = array("History", "Beliefs", "Staff");
$title = "Meet the Leadership";
$meta_key='leaders, meet, office, pastors';
$meta_desc="Meet the South Hill Calvary Chapel Leadership.";
$query="SELECT * FROM $table WHERE leader='1' ORDER BY display_order ASC";

print_html_head($title ,$meta_key,$meta_desc);

print_java_head(NULL);;
begin_body();
page_title_no_content($title);

$result=mysql_query($query) or die (mysql_error());
$num_rows=mysql_num_rows($result);
people($result, $num_rows);
mysql_close();

in_page_link(3, false, $linkList, $textList, "");
end_page_title();
end_body();
?>

